
/**
 * AppleIIGo
 * ADB (Apple Desktop Bus) class
 * (C) 2008 by Marc S. Ressl (mressl@umich.edu)
 * Released under the GPL
 */
 
#include "Motherboard.h"

#ifndef ADB_H
#define ADB_H

#define ADBKEYMODIFIER_SHIFT		(1 << 0)
#define ADBKEYMODIFIER_CONTROL		(1 << 1)
#define ADBKEYMODIFIER_CAPSLOCK		(1 << 2)
#define ADBKEYMODIFIER_REPEAT		(1 << 3)
#define ADBKEYMODIFIER_KEYPAD		(1 << 4)
#define ADBKEYMODIFIER_ISUPDATED	(1 << 5)
#define ADBKEYMODIFIER_OPTION		(1 << 6)
#define ADBKEYMODIFIER_COMMAND		(1 << 7)

#define ADBMOUSEDATA_BUTTONPRESSED	(1 << 7)

#define ADBDATA_REQUESTPENDING		(1 << 3)
#define ADBDATA_FLUSH				(1 << 4)
#define ADBDATA_RESET				(1 << 5)
#define ADBDATA_ABORT				(1 << 6)
#define ADBDATA_RESPONSE			(1 << 7)

#define ADBSTATUS_COMMANDFULL		(1 << 0)
#define ADBSTATUS_MOUSECOORDAVAIL	(1 << 1)
#define ADBSTATUS_KEYINTENABLE		(1 << 2)
#define ADBSTATUS_KEYDATAFULL		(1 << 3)
#define ADBSTATUS_DATAINTENABLE		(1 << 4)
#define ADBSTATUS_DATAFULL			(1 << 5)
#define ADBSTATUS_MOUSEINTENABLE	(1 << 6)
#define ADBSTATUS_MOUSEDATAFULL		(1 << 7)

class ADB : public Device {
public:
	ADB(class Motherboard * motherboard);
	
	void setKeyModifierRegister(UINT8 value);
	UINT8 getKeyModifierRegister();
	UINT8 getMouseDataRegister();
	void setDataRegister(UINT8 value);
	UINT8 getDataRegister();
	void setStatusRegister(UINT8 value);
	UINT8 getStatusRegister();

private:
	UINT8 keyModifierRegister;
	UINT8 statusRegister;	
};

#endif
